
GO

/****** Object:  StoredProcedure [dbo].[CMS_VideoClip_Delete]    Script Date: 06/17/2012 13:51:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[CMS_VideoClip_Delete]
(
	@VideoId int
)

AS

SET NOCOUNT ON

DELETE FROM [CMS_VideoClip]
WHERE [VideoId] = @VideoId

GO

/****** Object:  StoredProcedure [dbo].[CMS_VideoClip_Select]    Script Date: 06/17/2012 13:51:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- Author:		<duandm>
-- Create date: 
-- Description:	
-- =============================================
CREATE PROCEDURE [dbo].[CMS_VideoClip_Select]
@Type INT,
@Para_1 NVARCHAR(100) = NULL,
@Para_2 NVARCHAR(100) = NULL
AS
BEGIN	
	IF(@Type = 1) 
		BEGIN
			SELECT  * 
			FROM	[CMS_VideoClip]								
		END	
	IF(@Type = 2) 
		BEGIN
			SELECT * FROM [CMS_VideoClip]
			WHERE [VideoId] = CAST(@Para_1 AS INT)						
		END		
			
END

GO

/****** Object:  StoredProcedure [dbo].[CMS_VideoClip_Update]    Script Date: 06/17/2012 13:51:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[CMS_VideoClip_Update]
(
	@VideoId int,
	@Title nvarchar(200),
	@Teaser nvarchar(1000),
	@Body ntext,	
	@ShowType int,	
	@CreatedOn datetime,
	@CreatedBy nvarchar(100),
	@Avatar nvarchar(200),	
	@ZoneId int,
	@UrlVideo nvarchar(200)
)

AS

SET NOCOUNT ON

UPDATE [CMS_VideoClip]
SET [Title] = @Title,
	[Teaser] = @Teaser,
	[Body] = @Body,	
	[ShowType] = @ShowType,	
	[CreatedOn] = @CreatedOn,
	[CreatedBy] = @CreatedBy,
	[Avatar] = @Avatar,	
	[ZoneId] = @ZoneId,
	[UrlVideo] = @UrlVideo
WHERE [VideoId] = @VideoId

GO

/****** Object:  StoredProcedure [dbo].[CMS_VideoClip_Insert]    Script Date: 06/17/2012 13:51:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[CMS_VideoClip_Insert]
(
	@Title nvarchar(200),
	@Teaser nvarchar(1000),
	@Body ntext,
	@Status int,
	@ShowType int,
	@HitCount int,
	@CreatedOn datetime,
	@CreatedBy nvarchar(100),
	@Avatar nvarchar(200),
	@BigAvatar nvarchar(200),
	@ZoneId int,
	@UrlVideo nvarchar(200)
)

AS

SET NOCOUNT ON

INSERT INTO [CMS_VideoClip]
(
	[Title],
	[Teaser],
	[Body],
	[Status],
	[ShowType],
	[HitCount],
	[CreatedOn],
	[CreatedBy],
	[Avatar],
	[BigAvatar],
	[ZoneId],
	[UrlVideo]
)
VALUES
(
	@Title,
	@Teaser,
	@Body,
	@Status,
	@ShowType,
	@HitCount,
	@CreatedOn,
	@CreatedBy,
	@Avatar,
	@BigAvatar,
	@ZoneId,
	@UrlVideo
)

DECLARE @id int set @id=SCOPE_IDENTITY()
SELECT @id


GO


GO
/****** Object:  StoredProcedure [dbo].[CMS_Zones_UpdateZoneUrl]    Script Date: 06/17/2012 13:45:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

Create proc [dbo].[CMS_Zones_UpdateZoneUrl]
@zoneId int,
@ZoneUrl nvarchar(200)
as
update cms_zones set ZoneUrl=@ZoneUrl where zoneId=@zoneId